package com.atkxp.mapper;

import com.atkxp.dto.resp.AlgorithmDTO;
import com.atkxp.dto.resp.AlgorithmDescDTO;
import com.atkxp.dto.resp.Category;
import com.atkxp.dto.resp.ScratchPaperDescDTO;
import com.atkxp.entity.Algorithm;
import com.atkxp.entity.AlgorithmDescription;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author longhunpomie - 蒯兴鹏
 * @declaration
 * @email 3314028177@qq.com
 * @create 2025/3/29-16:59
 */
@Mapper
public interface AlgorithmMapper {
    public List<Category> getAllCategory();

    public List<AlgorithmDTO> getAllAlgorithmByCategory(@Param("category") String category);

    public List<AlgorithmDescDTO> getSimpleDesc(@Param("category") String category, @Param("name") String algorithm);

    public String getDesc(@Param("category") String category, @Param("name") String algorithm);

    public String getCode(@Param("category") String category, @Param("name") String algorithm, @Param("file") String file);

    public String getData(@Param("category") String category, @Param("name") String algorithm, @Param("file") String file);

    public String getTemplate(@Param("category") String category, @Param("name") String algorithm, @Param("file") String file);

    public String getScratchPaperData(@Param("userId") Long userId, @Param("file") String file);

    public String getScratchPaperCode(@Param("userId") Long userId, @Param("file") String file);

    public String getScratchPaperTemplate(@Param("userId") Long userId, @Param("file") String file);

    String getScratchPaperDesc(@Param("userId") Long userId);

    List<ScratchPaperDescDTO> getScratchPaperSimpleDesc(@Param("userId") Long userId);

    void updateScratchPaperDesc(@Param("userId") Long userId, @Param("markdown") String markdown);

    void insertScratchPaperDesc(@Param("userId") Long userId,  @Param("markdown") String markdown);

    Long existScratchPaperFileByFileName(@Param("userId") Long userId);

    void deleteScratchPaperFile(@Param("userId") Long userId);

    void insertScratchPaperFile(@Param("userId") Long userId,
                                @Param("file") String fileName,
                                @Param("order") Integer order,
                                @Param("code") String code,
                                @Param("data") String data,
                                @Param("template") String template,
                                @Param("desc") String desc);

    void insertAlgorithmDesc(AlgorithmDescription algorithmDescription);

    void insertAlgorithm(Algorithm algorithm);

    List<Category> getAllReviewCategory();

    List<AlgorithmDTO> getAllReviewAlgorithmByCategory(@Param("category") String category);

    Long onlineAlgorithm(@Param("category") String category, @Param("name") String name);

    Long refuseAlgorithm(@Param("category") String category, @Param("name") String name);
}
